1. Field of the Invention
The present invention relates to an image measuring apparatus for measuring a measuring object by imaging the measuring object.
2. Description of the Related Art
In an image measuring apparatus having an autofocusing function, images of a measuring object are sequentially acquired while an imaging device such as a camera or an optical system of the imaging device is moved in the direction of the optical axis thereof. Then, an in-focus position in the direction of the optical axis of the imaging device is calculated from the contrast of each of the images (see JP-A-2009-168607).
Hitherto, generally, an imaging device of the global shutter type has been mounted on such an image measuring apparatus. The imaging device of the global shutter type is suited to the above contrast type autofocusing, because exposure is performed simultaneously at all light receiving elements thereof.
On the other hand, an imaging device of the rolling shutter type has been known as that of the type differing from that of the global shutter type. The imaging device of the rolling shutter type is low in price, as compared with that of the global shutter type. However, when utilized for the above contrast type autofocusing, the imaging device of the rolling shutter type has the following problems.
That is, the imaging device of the rolling shutter type performs imaging sequentially on each column or pixel of light receiving elements configured by being arranged like an array. Accordingly, when imaging is performed while the imaging device of the rolling shutter type is moved in the direction of the optical axis, the position of the imaging device varies with that of the pixel at which an image is acquired.
When the position of the imaging device at the center of the light receiving timings of the light receiving elements is employed as a reference position, information on the position of the imaging device is acquired as that representing an imaging position, simultaneously with the reception of light by a centrally positioned one of the light receiving elements arranged like an array. Thus, a part, on which imaging is performed just after the start of the imaging, is imaged before the imaging at the reference position. Similarly, a part, on which imaging is performed just before the end of the imaging, is imaged after the reference position. Accordingly, if a part at which the contrast changes most in an imaging range is located apart from the center position of the imaging range, an error is caused between the in-focus position determined based on the contrast calculated from the acquired image and the acquired imaging position.